

class DbgGuiLeak
{
public:
    explicit DbgGuiLeak ()
    {
        _guiResCount = ::GetGuiResources (::GetCurrentProcess (),
                                          GR_GDIOBJECTS);
    }
    ~DbgGuiLeak ()
    {
        int leaks = ::GetGuiResources (::GetCurrentProcess (), 
                                       GR_GDIOBJECTS) - _guiResCount;
        if (leaks != 0)
        {
           TRACE(_T("LEAKED %d /n"), leaks);
           //ASSERT(0); 
           
        }
    }
private:
    unsigned _guiResCount;
};